package com.woldier.controller;

import com.woldier.mapper.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/yml-config") // 指定总目录
public class YmlController {
    @Value("${country}")
    private String country ;
    @Value("${likes[0]}") //读取数组中的一个元素
    private String like;
    @Value("${student.name}") //读取数组中的一个元素
    private String name;
    @Value("${tempDir}")
    private String dir;

    @Autowired
    private Environment env;

    @Autowired
    private DataSource dataSource;

    @GetMapping("country")


    public String getYmlParam(){
        System.out.println("country is "+country);
        System.out.println("like is "+like);
        System.out.println("name is "+name);
        System.out.println("dir is "+dir);

        System.out.println("--------------------------------------");
        System.out.println("env.country is "+env.getProperty("country"));

        System.out.println("--------------------------------------");
        System.out.println(dataSource);
        return "boot is running...";

    }






}
